import React, { Component } from 'react';
import {message} from 'antd';

export default class LikeButton extends Component {

    static defaultProps = {
        likedText: '取消',
        unlikedText: '点赞'
    }

    constructor (props) {
        super(props);
        this.state = { 
            isLiked: false 
        };
    }

    handleClickOnLikeButton () {
        this.setState({
            isLiked: !this.state.isLiked
        })
    }

    render () {
        return (
            <button onClick={this.handleClickOnLikeButton.bind(this)}>
                {this.state.isLiked ? this.props.likedText : this.props.unlikedText} 
            </button>
        )
    }
}